package com.sfh.sfhshopweb.mapper;

import com.sfh.sfhshopweb.entity.Goods;
import com.sfh.sfhshopweb.entity.GoodsCategoryRel;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 商品分类关联表 Mapper 接口
 * </p>
 *
 * @author kcyu
 * @since 2024-06-13
 */
public interface GoodsCategoryRelMapper extends BaseMapper<GoodsCategoryRel> {

    @Select("select g.* from shop_goods g join shop_goods_category_rel r on g.id = r.goods_id join shop_category c on c.id = r.category_id where c.id = #{categoryId} and g.enable = 1")
    List<Goods> getGoodsByCategoryId(Integer categoryId);


}
